﻿using System;
using System.Globalization;
using System.Windows.Data;
using System.Windows.Media;

namespace MetroApp.Web.Converters
{
    public class DrawingToImageConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value is Drawing drawing)
                return new DrawingImage(drawing);
            return null;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
            => throw new NotSupportedException();
    }
}
